if exists(select name from sysobjects where name = 'sp_KhuyenMaiDelete')
	drop proc sp_KhuyenMaiDelete
go
/*-- =============================================
	Created by: HP
	Created on: 2014-04-17 (dd/mm/yyyy)
	Description: 
	--

	File:$sql-scripts/Proc.sp_KhuyenMaiDelete.sql
*/-- =============================================

CREATE PROCEDURE sp_KhuyenMaiDelete
	@KhuyenMaiId		INT,
	@Type tinyint
AS
BEGIN
	if(@Type=0)
	begin
	UPDATE KhuyenMai SET TRANGTHAI=255
	WHERE
		    [KhuyenMaiId] = @KhuyenMaiId;
	end
	else
		begin
		delete LoaiKhuyenMaiAndKhuyenMai where KhuyenMaiId=@KhuyenMaiId
		delete KhuyenMai where KhuyenMaiId=@KhuyenMaiId
		end
END
GO
